package com.hu.edu;
import com.hu.edu.Edu;
import com.hu.edu.EduService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@Controller
public class EduController {
    @Autowired
    private EduService eduService_h;

    @RequestMapping("/edu/findAll")
    public String findAll(Model model){
        System.out.println("Controller表现层：遍历所有账户");

        List<Edu> list = eduService_h.findAll();
        model.addAttribute("list",list);
        return "list_h";
    }
    @RequestMapping("/edu/findById")
    public void findById(Edu edu, HttpServletRequest request, HttpServletResponse response) throws IOException {
        eduService_h.findById(edu);
        response.sendRedirect(request.getContextPath()+"/edu/findAll");
        return;
    }

}
